package com.systemsjr.jrenterprise.user;

import com.systemsjr.jrenterprise.user.vo.UserSearchCriteria;
import com.systemsjr.jrenterprise.utils.ServiceUtils;
import com.systemsjr.jrlib.richclient.BaseItemFilterForm;
import com.systemsjr.jrlib.richclient.table.JRTableUtils;

public class UserFilterForm extends BaseItemFilterForm {

	public UserFilterForm() {
		super("userSearchForm");
	}

	@Override
	protected void doCreateFormControl() {
		
		builder.row();
		builder.add("name");
		builder.row();
		builder.add("username");
		builder.row();
		builder.add("email");
		builder.row();
	}
	
	@Override
	protected Object newFormObject() {
		return new UserSearchCriteria();
	}
	
	@Override
	protected void doSearch() {
		commit();
		UserSearchCriteria object = (UserSearchCriteria) getFormObject();
		JRTableUtils.refreshTable(table, ServiceUtils.getUserService().search(object));
	}

}
